package com.zuxia.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.stereotype.Repository;

import com.zuxia.dao.IPositDao;
import com.zuxia.entity.Posit;

@Component
@Repository("positDao")
public class PositDao implements IPositDao{
	@Resource(name="hibernateTemplate")
	private HibernateTemplate hibernateTemplate;
	
	@SuppressWarnings("unchecked")
	public List<Posit> findAll() {
		return (List<Posit>) hibernateTemplate.find("from Posit");
	}
	@Autowired
	private SessionFactory sf;
	@Override
	public List<Posit> selectPosit() {
		// TODO Auto-generated method stub
		Session session = sf.getCurrentSession();
		Criteria create = session.createCriteria(Posit.class);
		return create.list();
	}

}
